package graphics.operations;

import graphics.Rettangolo;

import java.awt.Graphics;
import java.awt.event.MouseEvent;

public class AddRettangoloOperation extends Operation{
	Rettangolo rett;
	private int xStart;
	private int yStart;
	
	public void mousePressed(MouseEvent arg0) {
		rett=new Rettangolo();
		rett.setX(arg0.getX());
		rett.setY(arg0.getY());
		rett.setW(20);
		rett.setH(20);
		xStart=arg0.getX();
		yStart=arg0.getY();
		getData().addForma(rett);
		getData().aggiorna();
	}
	
	
	public void mouseClicked(MouseEvent arg0) {
		//Do nothing
	}
	
	
	public void mouseDragged(MouseEvent arg0) {
		int x=arg0.getX();
		int y=arg0.getY();
		rett.setW(x-xStart);
		rett.setH(y-yStart);
		getData().aggiorna();
	}
	
	
	public void mouseEntered(MouseEvent arg0) {
		//Do nothing
	}
	
	
	public void mouseExited(MouseEvent arg0) {
		//Do nothing
	}
	
	
	public void mouseMoved(MouseEvent arg0) {
		//Do nothing
	}
	
	
	public void mouseReleased(MouseEvent arg0) {
		//Do nothing
	}

	
	public void drawOperationInfo(Graphics graphics) {
		//Do nothing
	}
	
}
